﻿using System;
using System.Collections.Generic;
using Xunit;
using Glue.Internals;
using System.Collections;

namespace GlueTests.TypeExtensionTests
{
    public class When_checking_interface_type
    {
        [Fact]
        public void GenericList_Should_be_GenericEnumerable()
        {
            Assert.True(typeof(List<String>).IsOfInterfaceType(typeof(IEnumerable<>)));
        }

        [Fact]
        public void GenericIList_Should_be_GenericEnumerable()
        {
            Assert.True(typeof(IList<String>).IsOfInterfaceType(typeof(IEnumerable<>)));
        }

        [Fact]
        public void GenericICollection_Should_be_GenericEnumerable()
        {
            Assert.True(typeof(ICollection<String>).IsOfInterfaceType(typeof(IEnumerable<>)));
        }

        [Fact]
        public void GenericIEnumerable_Should_be_GenericEnumerable()
        {
            Assert.True(typeof(IEnumerable<String>).IsOfInterfaceType(typeof(IEnumerable<>)));
        }

        [Fact]
        public void IEnumerable_Should_not_be_GenericEnumerable()
        {
            Assert.False(typeof(IEnumerable).IsOfInterfaceType(typeof(IEnumerable<>)));
        }

        [Fact]
        public void Int_Should_not_be_GenericEnumerable()
        {
            Assert.False(typeof(int).IsOfInterfaceType(typeof(IEnumerable<>)));
        }

        [Fact]
        public void IList_Should_be_an_IList()
        {
            Assert.True(typeof(IList).IsOfInterfaceType(typeof(IList)));
        }

        [Fact]
        public void GenericList_Should_be_an_IList()
        {
            Assert.True(typeof(List<String>).IsOfInterfaceType(typeof(System.Collections.IList)));
        }

    }
}
